home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
MACD 5
/
MACD 5.bin
/
workbench
/
tools
/
czesc_3
/
multiuser
/
src
/
library
/
protection.c
< prev
next >
Wrap
C/C++ Source or Header
|
1994-06-29
|
3KB
|
109 lines
/************************************************************
* MultiUser - MultiUser Task/File Support System *
* --------------------------------------------------------- *
* Protection Bits Management *
* --------------------------------------------------------- *
* © Copyright 1993-1994 Geert Uytterhoeven *
* All Rights Reserved. *
************************************************************/
#include <exec/execbase.h>
#include <proto/exec.h>
#include <proto/dos.h>
#include "Protection.h"
#include "Misc.h"
#include "Task.h"
#include "Config.h"
#include "Locale.h"
#include "LibHeader.h"
/*
* Set the Default Protection Bits
*
* Public Library Function
*/
BOOL __asm __saveds muSetDefProtectionA(register __a0 struct TagItem *taglist)
{
struct muTags tags;
if (!InterpreteTagList(taglist, &tags))
return(FALSE);
if (tags.Global)
return(SetLevelDefProtect(tags.Task, tags.DefProtection));
else
return(SetTaskDefProtect(tags.Task, tags.DefProtection));
}
/*
* Get the Default Protection Bits
*
* Public Library Function
*/
ULONG __asm __saveds muGetDefProtection(register __d0 struct Task *task)
{
if (!task)
task = SysBase->ThisTask;
return(GetTaskDefProtect(task));
}
/*
* Set the protection bits for a file or directory
*
* Public Library Function
*/
BOOL __asm __saveds muSetProtection(register __d1 STRPTR name,
register __d2 LONG mask,
register __a6 struct muBase *muBase)
{
return(muBase->OLDSetProtection(name, mask, DOSBase));
}
/*
* Disallow setting the full protection bits
*
* Public Library Function
*/
BOOL __asm muLimitDOSSetProtection(register __d0 BOOL flag,
register __a6 struct muBase *muBase)
{
if (flag)
muBase->Config.Flags |= muCFGF_LimitDOSSetProtection;
else
muBase->Config.Flags &= ~muCFGF_LimitDOSSetProtection;
return(TRUE);
}
/*
* Replacement for the dos.library SetProtection() function
*/
BOOL __asm __saveds NEWSetProtection(register __d1 STRPTR name,
register __d2 LONG mask,
register __a6 struct DosLibrary *dosbase)
{
BPTR fl;
struct FileInfoBlock *fib;
if ((muBase->Config.Flags & muCFGF_LimitDOSSetProtection) &&
(fl = Lock(name, ACCESS_READ))) {
if (fib = AllocDosObject(DOS_FIB, NULL)) {
if (Examine(fl, fib))
mask = (mask&0x000000ff)|(fib->fib_Protection&0xffffff00);
FreeDosObject(DOS_FIB, fib);
}
UnLock(fl);
}
return(muBase->OLDSetProtection(name, mask, dosbase));
}